From: Keir Fraser Date: Thu, 4 Jun 2009 09:46:13 +0000 (+0100) Subject: xm: Don't die when trying to conect the console to short-lived domains X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13801 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=a161e0d852981658b56c0de457e213f7d9b02c22;p=xen.git xm: Don't die when trying to conect the console to short-lived domains As observed by Mick Joran, if short-lived domain exits cleanly then os.waitpid() will throw the following exception. This appears to be because the child process that is used to start the domain has detached from its parent. OSError: [Errno 10] No child processes Cc: Mick Jordan Signed-off-by: Simon Horman --- diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index fc99b15e7b..a9806099f7 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -1400,6 +1400,13 @@ def do_console(domain_name): for i in range(10): # Catch failure of the create process time.sleep(1) + try: + (p, rv) = os.waitpid(cpid, os.WNOHANG) + except OSError: + # Domain has started cleanly and then exiting, + # the child process used to do this has detached + print("Domain has already finished"); + break (p, rv) = os.waitpid(cpid, os.WNOHANG) if os.WIFEXITED(rv): if os.WEXITSTATUS(rv) != 0: